﻿using System;
using System.Data;
using System.Collections.Generic;
using AIM.Common;
using AIM.Model;
using BrightFrame.Aop;
namespace AIM.BLL
{
    [Connection]
    public class ArchiveKindBLL : ContextBoundObject
    {
        private readonly AIM.DAL.ArchiveKindDAL _archiveKindDAL = new AIM.DAL.ArchiveKindDAL();

        public List<ArchiveKind> QueryAll()
        {
            return _archiveKindDAL.QueryAll();
        }

        /*
        public ArchiveKindBLL()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string ArchiveKindId)
        {
            return _archiveKindDAL.Exists(ArchiveKindId);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(AIM.Model.ArchiveKind model)
        {
            _archiveKindDAL.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(AIM.Model.ArchiveKind model)
        {
            _archiveKindDAL.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(string ArchiveKindId)
        {

            _archiveKindDAL.Delete(ArchiveKindId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public AIM.Model.ArchiveKind GetModel(string ArchiveKindId)
        {

            return _archiveKindDAL.GetModel(ArchiveKindId);
        }

        /// <summary>
        /// 得到一个对象实体，从缓存中。
        /// </summary>
        public AIM.Model.ArchiveKind GetModelByCache(string ArchiveKindId)
        {

            string CacheKey = "tbArchiveKindModel-" + ArchiveKindId;
            object objModel = AIM.Common.DataCache.GetCache(CacheKey);
            if (objModel == null)
            {
                try
                {
                    objModel = _archiveKindDAL.GetModel(ArchiveKindId);
                    if (objModel != null)
                    {
                        int ModelCache = AIM.Common.ConfigHelper.GetConfigInt("ModelCache");
                        AIM.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
                    }
                }
                catch { }
            }
            return (AIM.Model.ArchiveKind)objModel;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return _archiveKindDAL.GetList(strWhere);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return _archiveKindDAL.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<AIM.Model.ArchiveKind> GetModelList(string strWhere)
        {
            DataSet ds = _archiveKindDAL.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<AIM.Model.ArchiveKind> DataTableToList(DataTable dt)
        {
            List<AIM.Model.ArchiveKind> modelList = new List<AIM.Model.ArchiveKind>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                AIM.Model.ArchiveKind model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new AIM.Model.ArchiveKind();
                    model.ArchiveKindId = dt.Rows[n]["ArchiveKindId"].ToString();
                    model.KindName = dt.Rows[n]["KindName"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
         * */
    }
}

